<?php /*a:2:{s:75:"/www/wwwroot/afanda.ccpingtai.cn/application/manage/view/live_addgoods.html";i:1585564136;s:66:"/www/wwwroot/afanda.ccpingtai.cn/application/manage/view/base.html";i:1596192950;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<script src="/static/public/My97DatePicker/WdatePicker.js"></script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>">
                <i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>商城</span>
            <span class="icon-angle-right"></span>
            <span>直播间管理</span>
            <span class="icon-angle-right"></span>
            <span>直播间商品</span>
            <a class="u-flush">
                <i class="icon-repeat"></i>
            </a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">

            <table class="m-table">
                <tbody>
                <tr>
                    <td width="15%"><label for="title">直播间名称<em>*</em></label></td>
                    <td><?php echo htmlentities($info['title']); ?></td>
                </tr>

                <tr>
                    <td colspan="2">
                        <div class="m-options cf">
                        <div class="m-opts fl"><a href="javascript:;" class="u-btn"><i class="icon-plus"></i>选择商品</a></div>
                        </div>
                    </td>
                </tr>


            </table>
            <form class="layui-form" id="j_form" style="padding-top: 20px;">
                <table class="m-table ">
                    <tbody>
                        <tr>
                            <th width="5%">ID</th>
                            <th width="10%">商品名称</th>
                            <th width="10%">销售价格</th>
                            <th width="10%">直播间价格</th>
                            <th width="10%">库存</th>
                            <th width="10%">时间</th>
                            <th width="10%">规格</th>
                            <th width="10%">操作</th>
                        </tr>
                        <?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): if( count($data)==0 ) : echo "" ;else: foreach($data as $key=>$v): ?>
                        <tr>
                            <td><?php echo htmlentities($v['id']); ?></td>
                            <td><?php echo htmlentities($v['goods_info']['goods_name']); ?></td>
                            <td><?php echo htmlentities($v['goods_info']['sale_price']); ?></td>
                            <td><input type="text" class="u-ipt u-ipt-small act_price" data-id="<?php echo htmlentities($v['id']); ?>" name="act_price"  placeholder="请输入价格" value="<?php echo htmlentities((isset($v['sale_price']) && ($v['sale_price'] !== '')?$v['sale_price']:0)); ?>" />元</td>
                            <td><?php echo htmlentities($v['goods_info']['goods_stock']); ?></td>
                            <td><?php echo htmlentities($v['create_time']); ?></td>
							<td class="m-opt">
								<a href="javascript:;" class="s_btn" data-live-id="<?php echo htmlentities($v['live_id']); ?>" data-goods-id="<?php echo htmlentities($v['goods_id']); ?>"  title="">设置规格价格</a>
							</td>
							<td class="m-opt">
                                <a href="javascript:;" title="删除" class="a-u-del" data-id="<?php echo htmlentities($v['id']); ?>"><i class="icon-trash"></i></a>
							</td>

                        </tr>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>

            </form>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>


<script>
    $(function(){
        layui.use('layer', function(){
            $('.u-btn').on('click', function () {
                layer.open({
                    type: 2,
                    title: '直播商品',
                    shadeClose: false,
                    shade: 0,
                    area: ['96%', '90%'],
                    content: '/manage/live/getgoods?id='+"<?php echo htmlentities($info['id']); ?>" //iframe的url
                });
            });

            $('.act_price').on('change',function () {
                var id =$(this).attr('data-id');
                var sale_price=$(this).val();

                $.post('/manage/live/setPrice',{id:id,sale_price:sale_price},function (res) {
                    if(res.code===1){
                        layer.msg(res.msg)
                    }else{
                        layer.msg(res.msg)
                    }
                })
            })

            $('.group_num').on('change',function () {
                var id =$(this).attr('data-id');
                var group_num=$(this).val();

                $.post('/manage/live/setGroup',{id:id,group_num:group_num},function (res) {
                    if(res.code===1){
                        layer.msg(res.msg)
                    }else{
                        layer.msg(res.msg)
                    }
                })
            })
            $('.s_btn').on('click', function () {
                var goods_id=$(this).attr('data-goods-id');//商品id
                var live_id =$(this).attr('data-act-id');//活动id

                layer.open({
                    type: 2,
                    title: '规格价格',
                    shadeClose: false,
                    shade: 0,
                    area: ['80%', '70%'],
                    content: '/manage/live/addsku?goods_id='+goods_id+"&live_id="+live_id//iframe的url
                });
            });
        })


        //删除
        /**
         * 删除
         */
        $('.a-u-del').on('click', function(){
            var id = $(this).attr('data-id');
            dialog.confirm('您确定删除此信息吗？', function(){
                $.get('/manage/live/delActGoods',{id:id},function (res) {
                    if(res.code===1){
                        layer.msg(res.msg);
                        setTimeout(function () {
                            window.location.reload();
                        },500);
                    }else{
                        layer.msg(res.msg)
                    }
                })
            });
            return false;
        });
    })
</script>

</body>
</html>